﻿<UserControl x:Class="SoftTeach.View.Personen.PersonenWorkspaceView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:SoftTeach="clr-namespace:SoftTeach"
             xmlns:Datenbank="clr-namespace:SoftTeach.ViewModel.Datenbank"
             xmlns:PersonenView="clr-namespace:SoftTeach.View.Personen" 
             xmlns:PersonenViewModel="clr-namespace:SoftTeach.ViewModel.Personen"
             xmlns:Setting="clr-namespace:SoftTeach.Setting" mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="600">
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Label Style="{StaticResource Header1}" Grid.Row="0" Margin="0,5,0,0" Content="{Binding Path=PersonenÜberschrift}"/>
    <StackPanel Grid.Row="1" Orientation="Horizontal">
      <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=AddPersonCommand}" 
                    ToolTip="Neue Person anlegen">
        <StackPanel Orientation="Horizontal">
          <Grid>
            <Image Source="/SoftTeach;component/Images/Person32.png"/>
            <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
          </Grid>
        </StackPanel>
      </Button>
      <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                    Command="{Binding Path=DeletePersonCommand}" 
                    ToolTip="Aktuelle Person löschen.">
        <StackPanel Orientation="Horizontal">
          <Grid>
            <Image Source="/SoftTeach;component/Images/Person32.png"/>
            <Image Source="/SoftTeach;component/Images/RemoveOverlay32.png"/>
          </Grid>
        </StackPanel>
      </Button>
      <RadioButton Content="Schüler" IsChecked="{Binding Path=IsShowingSchüler}" VerticalAlignment="Center" Margin="10,0,0,0"/>
      <RadioButton Content="Lehrer" VerticalAlignment="Center" Margin="10"/>
      <Label VerticalAlignment="Center">Sortiert nach:</Label>
      <ComboBox SelectedValuePath="Content" SelectedValue="{Binding Path=SortByItem}" Margin="10"
                Style="{StaticResource DatagridComboBoxElementStyle}" MinWidth="100">
        <Label>Vorname</Label>
        <Label>Nachname</Label>
        <Label>Jahrgang</Label>
      </ComboBox>
    </StackPanel>
    <DataGrid Grid.Row="2" 
                ItemsSource="{Binding Path=FilteredPersons}"
                SelectedItem="{Binding Path=CurrentPerson}" 
                AutoGenerateColumns="False">
      <DataGrid.Columns>
        <DataGridTemplateColumn Header="Kurzinfo" Width="*">
          <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
              <TextBlock Text="{Binding Path=PersonKurzinfo}"/>
            </DataTemplate>
          </DataGridTemplateColumn.CellTemplate>
          <DataGridTemplateColumn.CellEditingTemplate>
            <DataTemplate>
              <PersonenView:PersonDetailView/>
            </DataTemplate>
          </DataGridTemplateColumn.CellEditingTemplate>
        </DataGridTemplateColumn>
      </DataGrid.Columns>
    </DataGrid>
  </Grid>
</UserControl>
